<?php
/**
 * Created by PhpStorm.
 * User: win7
 * Date: 2018/5/2
 * Time: 16:31
 */

namespace app\api\controller;

use think\Request;

class User
{
    public function login() {
//         header('Access-Control-Allow-Origin:*');
//         header('Access-Control-Allow-Methods:*');
//         header('Access-Control-Allow-Headers:*');
//         header('Access-Control-Allow-Credentials:false');
        $request = Request::instance();
        $params = $request->param();
//        var_dump($params);
        $data = [
            'code' => 20000,
            'data' => [
                'token' => 'admin'
            ]
        ];
        return json($data);
    }
    public function info() {
        $request = Request::instance();
        $params = $request->param();
        $userInfo = [
            'code' => 20000,
            'data' => [
                'avatar' => 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif',
                'name' => '前端',
                'roles' => ['admin']
            ]
        ];
        return json($userInfo, 200);
    }
    public function logout() {

    }
}